<?php
//数据源来自json文件
class ml_biz_pin_guang extends ml_biz_pin_abstract{

    private $total_block;
    
    public function output($page_type , $block_num = 0 , $dest = '' , $uid = 0){

        $this->uid        = $uid;
        $this->ifme       = false;
        $this->uniqueData = $this->unique_Data($page_type , $block_num , $dest);
        $this->getUidRid();
        $this->get_cnt();
        //$this->get_attitude();
        $this->get_comment();
        //$this->get_ColCnt();
        $this->get_PicHeight();
        $this->get_nick();
        return $this->parseData();

    }
    function unique_Data($page_type , $block_num , $dest){
        $path = SYSDEF_PRIVDATA_ROOT_PATH.'/guang_data/';
        switch ($page_type)
        {
            case '24_new':
                $path .= '24h/new_block'.$block_num.'.json'; break;
            case '24_hot':
                $path .= '24h/hot_block'.$block_num.'.json'; break;
            case '7_new':
                $path .= '7day/new_block'.$block_num.'.json'; break;
            case '7_hot':
                $path .= '7day/hot_block'.$block_num.'.json'; break;
            case 'ctg_new':
                $path .= 'by_ctg/'.$dest.'/new_block'.$block_num.'.json'; break;
            case 'ctg_hot':
                $path .= 'by_ctg/'.$dest.'/hot_block'.$block_num.'.json'; break;
            case 'ctg_tag_new':
                $path .= 'ctg2tag/'.$dest.'/new_block'.$block_num.'.json'; break;
            case 'ctg_tag_hot':
                $path .= 'ctg2tag/'.$dest.'/hot_block'.$block_num.'.json'; break;
            case 'tag_new':
                $path .= 'by_tag/'.$dest.'/new_block'.$block_num.'.json'; break;
            case 'tag_hot':
                $path .= 'by_tag/'.$dest.'/hot_block'.$block_num.'.json'; break;
            case 'tag2_new':
                $path .= 'by_tag2/'.$dest.'/new_block'.$block_num.'.json'; break;
            case 'tag2_hot':
                $path .= 'by_tag2/'.$dest.'/hot_block'.$block_num.'.json'; break;
        }

        if(!is_file($path))
        return false;
            
        $data = json_decode(file_get_contents($path) , 1);
        $content = $data['rows'];
        $this->total_block = $data['block_num'];

        foreach ($content as &$row)
        {
            $row['rid'] = $row['content_rid'];                
        }
        return $content; 
    }

    public function get_total_block()
    {
        return $this->total_block;//这个是干嘛的？
    }


}